home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 19
/
Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso
/
Aminet
/
comm
/
www
/
HTMLDate.lha
/
HTMLDate.ged
next >
Wrap
Text File
|
1997-03-31
|
3KB
|
113 lines
/* Update the revision date in HTML docs, using GoldED ©1997 Roy E Brown
$VER: HTMLDate.ged V1.3 (31.3.97)
This script will update the revision date of your HTML pages.
Your date string can be in one of two styles:
(1) Last revised: 31 March 1997
(2) Last revised: Monday, 31 March 1997
The date itself can be surrounded by a maximum of one pair of text style tags
i.e '<B>31 March 1997</B>'.
The script searches for the default words 'Last revised' (without the quotes),
deletes the existing date and enters the current date into the text.
The script is configured to look for a 2-word string ("Last revised"). It then
assumes that these 2 words are followed by either a 3 or 4 word date string, as
in the 2 examples above.
Set the 2 words to search for in the variable 'Str' below.
Set the date style in the 'Style' variable below.
You should set the GoldED default date style (Extras/Options global/gui) to
the following (without the quotes) -
Style 1 '%e %B %Y'
Style 2 '%A, %e %B %Y' (The comma is optional)
This will then print the date in the correct format.
*/
Str="Last revised" /* Enter your required search string - 2 words maximum.
If you put more than 2 words, it won't work! */
Style=1 /* Set the style of your date string (see above) */
/* **************************************************************************
Please do not change anything below here, unless you know what you're doing
of course.
*************************************************************************** */
OPTIONS RESULTS /* enable return codes */
If (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
address 'GOLDED.1'
'LOCK CURRENT RELEASE=4' /* lock GUI, gain access */
If (RC ~= 0) Then
Exit
OPTIONS FAILAT 6 /* ignore warnings */
SIGNAL ON SYNTAX /* ensure clean exit */
If Style<1|Style>2 Then
Do
Say "The Style variable is outside the allowed range"
'UNLOCK'
Exit
End
/* Let's find the string and jump to it */
'FIND STRING="'Str'" FIRST WORDS=0'
/* Move cursor along 2 words and back one place */
'NEXT';'NEXT';'LEFT'
/* Let's see what the ASCII code of the character under the cursor is */
'QUERY CODE' /* '<' is ASCII Code 60 */
If (RESULT=60) Then 'NEXT';'NEXT' /* Let's move past the HTML tag */
/* Mark the start of the block, move to the last character of the date,
mark the end of the block and delete the existing date.
*/
'MARK SET COLUMN BEGIN'
If Style=1 Then /* 31 March 1997 */
Do
'NEXT';'NEXT';'ENDWORD'
End
If Style=2 Then /* Monday, 31 March 1997 */
Do
'NEXT';'NEXT';'NEXT';'ENDWORD'
End
'MARK SET END'
'DELETE BLOCK'
/* Put the new date into the document */
'QUERY DATE'
'TEXT T "'RESULT'"'
'UNLOCK' /* VERY important: unlock GUI */
Exit
SYNTAX:
Say "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
'UNLOCK'
Exit